﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Eg.Core" namespace="Eg.Core">
    <class name="Orders" table="Orders">
        <id name="OrderId">
            <generator class="identity"/>
        </id>
        <property name="Price" type="Decimal"/>
        <property name="CreateTime" type="DateTime"/>
        <property name="State" type="Eg.Core.OrderState,Eg.Core"/>
        <many-to-one name="Customer" column="Customer" not-null="true"
                 class="Eg.Core.Customer"
                 foreign-key="FK_CustomerOrders" />
        <bag name="Products" generic="true" table="OrderProducts">
            <key column="Order" foreign-key="FK_OrderProducts"></key>
            <many-to-many column="Product" class="Eg.Core.Product" foreign-key="FK_ProductOrders"/>
        </bag>
    </class>
</hibernate-mapping>